cmake_minimum_required (VERSION 3.26)
project(WuhuaEngine VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 20)

set(Application ScriptRunner)


set(EngineDirectory ${CMAKE_CURRENT_LIST_DIR}/../../Engine)


file(GLOB_RECURSE AllCppFiles ./*.cpp ./*.h )

#TODO use ${CMAKE_CXX_COMPILER_ID} to optional add Natvis file 
add_executable(${Application} ${AllCppFiles}  "${EngineDirectory}/Modules/EngineCore/WuhuaEngine.natvis" )

target_link_libraries(${Application} PUBLIC 
  EngineCore 

  )

target_include_directories(${Application} PUBLIC 
  ${CMAKE_CURRENT_LIST_DIR}
)

#set DEBUG Macro
target_compile_definitions(${Application} PUBLIC "$<$<CONFIG:DEBUG>:DEBUG>")



set(EngineSourceDirectory ${EngineDirectory}/Modules/EngineCore/Source)
add_custom_target(Reflected_${Application}
    USES_TERMINAL 
    COMMAND  $<TARGET_FILE:EngineReflectionTool>       
      ${CMAKE_CURRENT_LIST_DIR} ${Application}
      ${EngineSourceDirectory}  "EngineCore"
)

add_dependencies(${Application} Reflected_${Application} )




message("PrepareCointent :" Prepare${Application}Content)

add_custom_target(Prepare${Application}Content
USES_TERMINAL 

#copy contents
COMMAND ${CMAKE_COMMAND} -E copy_directory 
${CMAKE_CURRENT_LIST_DIR}/Content
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/Content/${Application}>$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/Content/${Application}>

)

add_dependencies(${Application}  Prepare${Application}Content)
